//第一层
var express = require('express');
var router = express.Router();

// const mongoose = require('mongoose');

//引入服务层函数
const {add2,get2,delete2,getOne2,updataOne2} = require('../server/adminServer');


//增加
router.post('/add',async function(req,res,next){
    res.send(await add2(req.body));
});

//获取和搜索
router.get('/get',async function(req,res,next){
    res.send(await get2(req.query))
})

//删除
router.delete('/del',async function(req,res,next){
    res.send(await delete2(req.body))
})

//获取修改的数据
router.get('/getOne',async function(req,res,next){
    res.send(await getOne2(req.query))
})

//修改
router.post('/updataOne',async function(req,res,next){
    res.send(await updataOne2(req.body))
})



module.exports = router;